<template>
  <div id="app">
    <!-- <img alt="Vue logo" src="./assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/> -->
    <app-header></app-header>
    <app-nav @changeContent="passContentIndex"></app-nav>
    <app-content :displayCompIndex="contentIndex"></app-content>
  </div>
</template>

<script lang="ts">
import Vue from "vue";
import VueCompositionAPI, { ref } from "@vue/composition-api";
// import HelloWorld from './components/HelloWorld.vue'
import appHeader from "./components/header-comp/app-header.vue";
import appNav from "./components/tab-comp/app-tab.vue";
import appContent from "./components/content-comp/app-content.vue";

// 使用CompositionAPI
Vue.use(VueCompositionAPI);

// 内容组件索引
const contentIndex = ref(0);
// 下传内容索引函数
function passContentIndex(index: number) {
  // console.log(index, "pass");
  contentIndex.value = index;
}

export default Vue.extend({
  name: "App",
  components: {
    appHeader,
    appNav,
    appContent,
  },
  setup() {
    return {
      passContentIndex,
      contentIndex,
    };
  },
});
</script>

<style lang="stylus">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
</style>
